# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-bacpypes
pkgname=('python2-bacpypes' 'python-bacpypes')
_pkgname=bacpypes
pkgver=0.17.6
pkgrel=7
pkgdesc='Testing multiple versions of python.'
arch=('any')
url='https://github.com/JoelBender/bacpypes'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://github.com/JoelBender/bacpypes/archive/v$pkgver.tar.gz")
sha512sums=('50e62a3274db7938a448a92f9695c95f5e0a3635d334003b416fe1711bf7650fd4e202b06b09c09e22a80224a75d955429d90cc19c611dbf5b153978be0797f9')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-bacpypes() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-bacpypes() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

